<template>
  <div class="app1">
    <div class="title">热销</div>
    <div class="tabberRight">
        <div class="rightList"  v-for="(item,index) in tabs[currentIndex].List" :key="index">
            <img :src="item.pic" alt="">
            <div class="text">
               <h4>{{item.name}}</h4> 
               <div><span>￥：{{item.price}}</span></div>
            </div>
        </div>
    </div>
  </div>
</template>

<script>
import eventBus from "../utils/tools"
import pic1 from "../assets/2.png"
import pic2 from "../assets/3.png"
import pic3 from "../assets/4.png"
import pic4 from "../assets/5.png"
export default {
    data(){
        return {
            currentIndex:0,
            tabs:[
                {tabberName:"三文鱼",
                    List:[
                        {pic:pic1,name:"挪威三文鱼",price:45},
                        {pic:pic1,name:"纯鲜三文鱼",price:85},
                        {pic:pic1,name:"日本三文鱼",price:65},
                        {pic:pic1,name:"三文鱼片",price:35}]},

                 {tabberName:"刺身",
                   List:[
                        {pic:pic2,name:"生蚝刺身",price:23},
                        {pic:pic2,name:"三文鱼刺身",price:25},
                        {pic:pic2,name:"石斑鱼刺身",price:87},
                        {pic:pic2,name:"刺身拼盘",price:55}]},

                 {tabberName:"大虾",
                   List:[
                        {pic:pic3,name:"北极冰虾",price:12},
                        {pic:pic3,name:"活虾",price:8},
                        {pic:pic3,name:"大对虾",price:30},
                        {pic:pic3,name:"小龙虾",price:12}]},

                 {tabberName:"贝类",
                    List:[
                        {pic:pic4,name:"北极贝",price:65},
                        {pic:pic4,name:"青贝",price:85},
                        {pic:pic4,name:"青岛贝",price:33},
                        {pic:pic4,name:"百贝",price:11}]}
            
            ]
        }
    },
    mounted(){
        eventBus.$emit("Rmsg",this.tabs),
        eventBus.$on("Lmsg",(msg)=>{
           this.currentIndex=msg
        })
    }
}
</script>

<style lang="scss" scoped>
.title{
    margin-top: 30px;
}
.rightList{
    display: flex;
    margin-bottom: 20px;
    margin-top: 10px;
}
.rightList img {
    width: 80px;
    height: 80px;
}
.text{
    display: flex;
    margin-left: 10px;
    flex-direction: column;
    justify-content: space-between;
}
.text span{
    color: red;
}
</style>